var $ = getApp(), methods = require("../methods.js");
Page(Object.assign({}, methods, {
	data: {
		prodata: '',
		isload: 0
	},
	_onLoad: function (option) {
		var that = this;
		$.get('collage/orderdetail', { id: that.options.id }, function (res) {
			res.isload = 1;
			that.setData(res);
		});
	},
	todel: function (e) {
		var that = this;
		var orderid = e.currentTarget.dataset.id
		$.confirm('确定要删除该订单吗?', function () {
			$.post('collage/delOrder', { orderid: orderid }, function (data) {
				$.success(data.msg);
				setTimeout(function () {
					that.onLoad();
				}, 1000)
			}, '删除中');
		})
	},
	toclose: function (e) {
		var that = this;
		var orderid = e.currentTarget.dataset.id
		$.confirm('确定要关闭该订单吗?', function () {
			$.post('collage/closeOrder', { orderid: orderid }, function (data) {
				$.success(data.msg);
				setTimeout(function () {
					that.onLoad();
				}, 1000)
			}, '提交中');
		})
	},
	orderCollect: function (e) {
		var that = this;
		var orderid = e.currentTarget.dataset.id
		$.confirm('确定要收货吗?', function () {
			$.post('collage/orderCollect', { orderid: orderid }, function (data) {
				$.success(data.msg);
				setTimeout(function () {
					that.onLoad();
				}, 1000)
			})
		}, '收货中');
	},
}))